/*
    Upload
    author: zhao xin
    date: 2017.4
*/


! function($) {
    'use strict';

    $(document).ready(function($) {
    	$('body').on('change', 'input[type=file]', function(event) {
    		var files = this.files;
    		var $filePath = $(this).siblings('.file-path-wrapper').find('.file-path');

    		if (files.length === 0) {
				$filePath.val('');
    		} else if (files.length === 1) {
    			var filePath = files[0].name;

    			$filePath.val(filePath);
    		} else {
    			$filePath.val('你选择了' + files.length + '个文件');
    		}
    	});
    });
}(jQuery);